//package com.example.thymeleaf.web.filter;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.io.PrintWriter;
//
///**
// * @Description: TODO
// * @author: 李展鹏
// * @date: 2024年05月31日10:23
// * 过滤器
// */
//public class AuthorizationFilter implements Filter {
//
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//        System.out.println("===============================init");
////        Filter.super.init(filterConfig);
//    }
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletRequest httpRequest= (HttpServletRequest) servletRequest;
//        HttpServletResponse httpResponse= (HttpServletResponse) servletResponse;
//        if (httpRequest.getSession().getAttribute("devUserSession")==null){
//            httpResponse.setContentType("text/html;charset=UTF-8");
//            PrintWriter out=httpResponse.getWriter();
//            out.println("<script>alert('请先进行登录，在进行后续操作(过滤器)!');location.href='"+httpRequest.getContextPath()+"/dev/toLogin';</script>");
//        }else {
//            filterChain.doFilter(httpRequest,httpResponse);
//        }
//    }
//
//    @Override
//    public void destroy() {
////        Filter.super.destroy();
//        System.out.println("===============================destroy");
//    }
//}
